﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;

namespace Ele21RHelp.ViewMode
{
    public class 恶灵注入Model : ObservableObject
    {
        /// <summary>
        /// 用户当前序号
        /// </summary>
        private string _UserIndex;
        /// <summary>
        /// 用户当前序号
        /// </summary>
        public string UserIndex
        {
            get => _UserIndex;
            set { SetProperty(ref _UserIndex, value);
            foreach (var item in Data)
                {
                    item.selectindex= value;
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        private string _rowindex;
        /// <summary>
        /// 
        /// </summary>
        public string rowindex { get => _rowindex; set
            {
                SetProperty(ref _rowindex, value);
                foreach (var item in Data)
                {
                    item.selectrowindex = value;
                }
            }
        }
        /// <summary>
        /// 数据
        /// </summary>
        private List<恶灵注入ModelData> _Data;
        /// <summary>
        /// 数据
        /// </summary>
        public List<恶灵注入ModelData> Data { get => _Data; set => SetProperty(ref _Data, value); }

        public 恶灵注入Model()
        {
            Data = new List<恶灵注入ModelData>();
            Data.Add(new 恶灵注入ModelData(1,"123","4","5","6"));
            Data.Add(new 恶灵注入ModelData(2,"12345", "12345", "6","6"));
            Data.Add(new 恶灵注入ModelData(3, "12345", "123456", "123456", "6"));
            Data.Add(new 恶灵注入ModelData(4, "123456", "123456", "123456", "123456"));
            Data.Add(new 恶灵注入ModelData(5, "123456", "123456", "123456", "远"));
            Data.Add(new 恶灵注入ModelData(6, "123456", "123456", "远","远"));
            Data.Add(new 恶灵注入ModelData(7, "123456", "远","远","远"));
            Data.Add(new 恶灵注入ModelData(8,"远","远","远","远"));
        }
    }
    public class 恶灵注入ModelData : ObservableObject
    {
        public int index { get; set; }
        private string _selectindex;
        public string selectindex { get=> _selectindex;
            set {
                _selectindex = value;
                value1Has= value1.Contains(selectindex);
                value2Has= value2.Contains(selectindex);
                value3Has= value3.Contains(selectindex);
                value4Has= value4.Contains(selectindex);
            } }

        public string value1 { get; set; }
        public string value2 { get; set; }
        public string value3 { get; set; }
        public string value4 { get; set; }
        /// <summary>
        /// 
        /// </summary>
        private bool _value1Has;
        /// <summary>
        /// 
        /// </summary>
        public bool value1Has { get => _value1Has; set => SetProperty(ref _value1Has, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _value2Has;
        /// <summary>
        /// 
        /// </summary>
        public bool value2Has { get => _value2Has; set => SetProperty(ref _value2Has, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _value3Has;
        /// <summary>
        /// 
        /// </summary>
        public bool value3Has { get => _value3Has; set => SetProperty(ref _value3Has, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _value4Has;
        /// <summary>
        /// 
        /// </summary>
        public bool value4Has { get => _value4Has; set => SetProperty(ref _value4Has, value); }
        /// <summary>
        /// 
        /// </summary>
        private string _selectrowindex;
        /// <summary>
        /// 
        /// </summary>
        public string selectrowindex { get => _selectrowindex; set { SetProperty(ref _selectrowindex, value); 
            if(index.ToString()== _selectrowindex)
                {
                    isSelectRow = true;
                }
                else
                {
                    isSelectRow = false;
                }
            } }
        /// <summary>
        /// 
        /// </summary>
        private bool _isSelectRow;
        /// <summary>
        /// 
        /// </summary>
        public bool isSelectRow { get => _isSelectRow; set => SetProperty(ref _isSelectRow, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _isAll1;
        /// <summary>
        /// 
        /// </summary>
        public bool isAll1 { get => _isAll1; set => SetProperty(ref _isAll1, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _isAll2;
        /// <summary>
        /// 
        /// </summary>
        public bool isAll2 { get => _isAll2; set => SetProperty(ref _isAll2, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _isAll3;
        /// <summary>
        /// 
        /// </summary>
        public bool isAll3 { get => _isAll3; set => SetProperty(ref _isAll3, value); }

        /// <summary>
        /// 
        /// </summary>
        private bool _isAll4;
        /// <summary>
        /// 
        /// </summary>
        public bool isAll4 { get => _isAll4; set => SetProperty(ref _isAll4, value); }

        public 恶灵注入ModelData(int index, string v1, string v2, string v3, string v4)
        {
            this.index = index;
            value1 = v1;
            value2 = v2;
            value3 = v3;
            value4 = v4;
            selectindex = "8";
            if (value1=="123456")
            {
                isAll1 = true;
            }
            if (value2 == "123456")
            {
                isAll2 = true;
            }
              if (value3=="123456")
            {
                isAll3 = true;
            }
            if (value4 == "123456")
            {
                isAll4 = true;
            }
        }
    }
}
